﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class Panel_False : BasePanel
{
    public Text textLevel;
    
    
    public override void OnEnter()
    {
        base.OnEnter();
        gameObject.SetActive(true);
        FalsePanelShow();
    }
    public override void OnExit()
    {
        base.OnExit();
        gameObject.SetActive(false);
    }
    public override void OnPause()
    {
        base.OnPause();
    }
    public override void OnResume()
    {
        base.OnResume();
    }

    private void Update()
    {
        if (Input.GetButtonDown("Cancel"))
        {
            GameControl.instance.GameOver();
            UIManager.Instance.PopPanel();
        }
    }

    /// <summary>
    /// 退出游戏失败界面
    /// </summary>
    public void Button_Close()
    {
        UIManager.Instance.PopPanel();
    }

    /// <summary>
    /// 再来一次
    /// </summary>
    public void Button_StartAgain()
    {
        UIManager.Instance.PopPanel();
        GameControl.instance.GameBegin();
    }

    /// <summary>
    /// 看广告，跳过此关卡
    /// </summary>
    public void Button_SkipLevel()
    {
        /******广告位*****/

        User.instance.skipBool = true;
        GoogleAdMobController.instance.ShowRewardAd();
    }

    public void FalsePanelShow()
    {
        int levelNum = User.instance.CurLevel;
        textLevel.text = (levelNum + 1).ToString();
    }

}
